﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;

namespace ConfigServices
{
    public class IniFileConfigService : IConfigService
    {
        public string FilePath { set; get; }

        public string GetValue(string name)
        {
            var kv = File.ReadAllLines(FilePath).Select(s => s.Split("=")).Select(ss => new { Name = ss[0], Value = ss[1] }).SingleOrDefault(kv => kv.Name == name);
            if (kv != null)
            {
                return kv.Value;
            }
            return null;
        }
    }
}
